/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package GUI;

import engine.linkList.ClassifyBy;
import engine.linkList.LinkedListManager;
import engine.linkList.MusicListNode;
import engine.linkList.MusicLists;
import engine.linkList.MusicNode;
import engine.linkList.Node;
import engine.linkList.PlayMode;
import engine.linkList.PlayScheduleManager;
import engine.linkList.SortBy;
import engine.player.MusicPlayer;
import java.awt.CardLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.MouseInfo;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import javax.swing.JSlider;
import javax.swing.JTable;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.JTableHeader;

/**
 *
 * @author hjp
 */
public class MusicPlayerUI extends javax.swing.JFrame {

    /**
     * Creates new form
     */
    public MusicPlayerUI() {
        //大小为1569,856
        //setPreferredSize(new Dimension(1100,700));
        setUndecorated(true);
        initComponents();
         //设置JTable的样式
         JTableHeader []heads = {musicListTabel.getTableHeader(),classifyMusicListTabel.getTableHeader()};
         for(JTableHeader head : heads){
             head.setPreferredSize(new Dimension(head.getWidth(), 48));
             head.setFont(new Font("楷体", Font.BOLD, 24));// 设置表格字体
             head.setBackground(new Color(255,255,255));
         }
         //修改两个JTable的背景色
         jScrollPane2.getViewport().setBackground(new Color(250,250,250));
         jScrollPane5.getViewport().setBackground(new Color(250,250,250));
         //设置初始化的时候显示cardLayout的第一张card
         CardLayout card = (CardLayout)listPanel.getLayout();
         card.show(listPanel,"card1");
         //设置默认的关闭模式
         setDefaultCloseOperation(1);
         //初始化一些中间变量
         transientCurrentVisitMusicLists = LinkedListManager.getInstance().getCurrentVisitMusicLists();
         transientClassifyCurrentVisitMusicLists = null;
         transientCurrentVisitMusicList = LinkedListManager.getInstance().getCurrentVisitMusicList();
         //初始化歌曲的排序方式
         sortby = SortBy.DEFAULT;
         currentCard = "card1";
         
         //控制控件大小
//         int fraWidth = this.getWidth();//frame的宽
//         int fraHeight = this.getHeight();//frame的高
//         Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
//         int screenWidth = screenSize.width;
//         int screenHeight = screenSize.height;
          //setSize(1000,550);
//         float proportionW =  (float)((1000 * 1.0) / screenWidth);
//         float proportionH =   (float)((550 * 1.0)/ screenHeight);
//         modifyComponentSize(this, proportionW,proportionH);
         
         //设置UI的任务栏图标
         java.net.URL imgURL = getClass().getResource("/GUI/icons/icons8-披头士-48.png") ;
         ImageIcon imageIcon = new ImageIcon(imgURL);  
         setIconImage(imageIcon.getImage());
         //将UI放置到屏幕中央
         setLocationRelativeTo(null);
    }
    
    private void modifyComponentSize(JFrame frame,float proportionW,float proportionH){
        try{
            java.awt.Component[] components = frame.getRootPane().getContentPane().getComponents();
            for(java.awt.Component co:components){
                    JPanel panel = (JPanel)co;
                    float locX = panel.getX() * proportionW;
                    float locY = panel.getY() * proportionH;
                    float width = panel.getWidth() * proportionW;
                    float height = panel.getHeight() * proportionH;
                    panel.setLocation((int)locX, (int)locY);
                    panel.setSize((int)width, (int)height);
                    int size = (int)(panel.getFont().getSize() * proportionH);
                    Font font = new Font(panel.getFont().getFontName(), panel.getFont().getStyle(), size);
                    panel.setFont(font);
//                for (java.awt.Component a : panel.getComponents()) {
//                    float locX = a.getX() * proportionW;
//                    float locY = a.getY() * proportionH;
//                    float width = a.getWidth() * proportionW;
//                    float height = a.getHeight() * proportionH;
//                    a.setLocation((int)locX, (int)locY);
//                    a.setSize((int)width, (int)height);
//                    int size = (int)(a.getFont().getSize() * proportionH);
//                    Font font = new Font(a.getFont().getFontName(), a.getFont().getStyle(), size);
//                    a.setFont(font);
//                }
            }
        }catch(Exception e){
            e.printStackTrace();
        }
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        iconPanel = new javax.swing.JPanel();
        MusicPlayerIcon = new javax.swing.JLabel();
        titleBarPanel = new javax.swing.JPanel();
        filler1 = new javax.swing.Box.Filler(new java.awt.Dimension(1146, 0), new java.awt.Dimension(1146, 0), new java.awt.Dimension(1146, 32767));
        minmumButton = new javax.swing.JButton();
        closeButton = new javax.swing.JButton();
        musicListsPanel = new javax.swing.JPanel();
        localMusicListPanel = new javax.swing.JPanel();
        localMusicListIconLabel = new javax.swing.JLabel();
        localMusicListLabel = new javax.swing.JLabel();
        createMusicListButton = new javax.swing.JButton();
        deleteSelectedMusicLists1 = new javax.swing.JButton();
        jScrollPane6 = new javax.swing.JScrollPane();
        createMusicListsPanel = new javax.swing.JPanel();
        jLabel2 = new javax.swing.JLabel();
        playControllerPanel = new javax.swing.JPanel();
        preMusicButton = new javax.swing.JButton();
        play_pauseButton = new javax.swing.JButton();
        nextMusicButton = new javax.swing.JButton();
        musicInfoPanel = new javax.swing.JPanel();
        musicNameLabel = new javax.swing.JLabel();
        musicCcoverIconLabel = new javax.swing.JLabel();
        currentPlayTimeJSlider = new javax.swing.JSlider();
        playModeButton = new javax.swing.JButton();
        currentPlayTimeJLabel = new javax.swing.JLabel();
        musicListInfoPanel = new javax.swing.JPanel();
        currentVisitMusicListLabel = new javax.swing.JLabel();
        addLocalToScanFolderNodeButton = new javax.swing.JButton();
        matchMusicButton = new javax.swing.JButton();
        mainPanel = new javax.swing.JPanel();
        functionPanel = new javax.swing.JPanel();
        searchInLocalMusicListTextFiled = new javax.swing.JTextField();
        sortByCombox = new javax.swing.JComboBox<>();
        defaultListButton = new javax.swing.JButton();
        artistButton = new javax.swing.JButton();
        albumButton = new javax.swing.JButton();
        localListButton = new javax.swing.JButton();
        searchLocalMusicLabel = new javax.swing.JLabel();
        listPanel = new javax.swing.JPanel();
        classifyPanel = new javax.swing.JPanel();
        jScrollPane5 = new javax.swing.JScrollPane();
        classifyMusicListTabel = new javax.swing.JTable();
        jScrollPane1 = new javax.swing.JScrollPane();
        classifyListPanel = new javax.swing.JPanel();
        searchLocalMusicLabel1 = new javax.swing.JLabel();
        searchInLocalMusicListsTextFiled = new javax.swing.JTextField();
        jScrollPane2 = new javax.swing.JScrollPane();
        musicListTabel = new javax.swing.JTable();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        iconPanel.setBackground(new java.awt.Color(241, 241, 241));
        iconPanel.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
            public void mouseDragged(java.awt.event.MouseEvent evt) {
                iconPanelMouseDragged(evt);
            }
        });
        iconPanel.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mousePressed(java.awt.event.MouseEvent evt) {
                iconPanelMousePressed(evt);
            }
        });

        MusicPlayerIcon.setIcon(new javax.swing.ImageIcon(getClass().getResource("/GUI/icons/icons8-披头士-96.png"))); // NOI18N

        javax.swing.GroupLayout iconPanelLayout = new javax.swing.GroupLayout(iconPanel);
        iconPanel.setLayout(iconPanelLayout);
        iconPanelLayout.setHorizontalGroup(
            iconPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(iconPanelLayout.createSequentialGroup()
                .addGap(38, 38, 38)
                .addComponent(MusicPlayerIcon, javax.swing.GroupLayout.PREFERRED_SIZE, 112, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(180, Short.MAX_VALUE))
        );
        iconPanelLayout.setVerticalGroup(
            iconPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(iconPanelLayout.createSequentialGroup()
                .addComponent(MusicPlayerIcon)
                .addGap(0, 4, Short.MAX_VALUE))
        );

        getContentPane().add(iconPanel, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 330, 100));

        titleBarPanel.setBackground(new java.awt.Color(250, 250, 250));
        titleBarPanel.setName(""); // NOI18N
        titleBarPanel.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
            public void mouseDragged(java.awt.event.MouseEvent evt) {
                titleBarPanelMouseDragged(evt);
            }
        });
        titleBarPanel.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mousePressed(java.awt.event.MouseEvent evt) {
                titleBarPanelMousePressed(evt);
            }
        });

        minmumButton.setBackground(new java.awt.Color(250, 250, 250));
        minmumButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/GUI/icons/delete.png"))); // NOI18N
        minmumButton.setToolTipText("最小化");
        minmumButton.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(250, 250, 250), 1, true));
        minmumButton.setContentAreaFilled(false);
        minmumButton.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        minmumButton.setFocusPainted(false);
        minmumButton.setPreferredSize(new java.awt.Dimension(32, 32));
        minmumButton.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                minmumButtonMouseClicked(evt);
            }
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                minmumButtonMouseEntered(evt);
            }
            public void mouseExited(java.awt.event.MouseEvent evt) {
                minmumButtonMouseExited(evt);
            }
        });
        minmumButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                minmumButtonActionPerformed(evt);
            }
        });

        closeButton.setBackground(new java.awt.Color(250, 250, 250));
        closeButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/GUI/icons/close.png"))); // NOI18N
        closeButton.setToolTipText("关闭");
        closeButton.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(250, 250, 250), 1, true));
        closeButton.setContentAreaFilled(false);
        closeButton.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        closeButton.setFocusPainted(false);
        closeButton.setPreferredSize(new java.awt.Dimension(32, 32));
        closeButton.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                closeButtonMouseClicked(evt);
            }
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                closeButtonMouseEntered(evt);
            }
            public void mouseExited(java.awt.event.MouseEvent evt) {
                closeButtonMouseExited(evt);
            }
        });

        javax.swing.GroupLayout titleBarPanelLayout = new javax.swing.GroupLayout(titleBarPanel);
        titleBarPanel.setLayout(titleBarPanelLayout);
        titleBarPanelLayout.setHorizontalGroup(
            titleBarPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(titleBarPanelLayout.createSequentialGroup()
                .addGap(10, 10, 10)
                .addComponent(filler1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(5, 5, 5)
                .addComponent(minmumButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(5, 5, 5)
                .addComponent(closeButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
        );
        titleBarPanelLayout.setVerticalGroup(
            titleBarPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(titleBarPanelLayout.createSequentialGroup()
                .addGroup(titleBarPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(titleBarPanelLayout.createSequentialGroup()
                        .addGap(21, 21, 21)
                        .addComponent(filler1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(titleBarPanelLayout.createSequentialGroup()
                        .addGap(5, 5, 5)
                        .addComponent(minmumButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(titleBarPanelLayout.createSequentialGroup()
                        .addGap(5, 5, 5)
                        .addComponent(closeButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(43, 43, 43))
        );

        getContentPane().add(titleBarPanel, new org.netbeans.lib.awtextra.AbsoluteConstraints(330, 0, 1240, 80));

        musicListsPanel.setBackground(new java.awt.Color(241, 241, 241));
        musicListsPanel.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                musicListsPanelMouseClicked(evt);
            }
        });

        localMusicListPanel.setBackground(new java.awt.Color(241, 241, 241));
        localMusicListPanel.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        localMusicListPanel.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                localMusicListPanelMouseClicked(evt);
            }
        });

        localMusicListIconLabel.setBackground(new java.awt.Color(241, 241, 241));
        localMusicListIconLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/GUI/icons/local.png"))); // NOI18N
        localMusicListIconLabel.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                localMusicListIconLabelMouseClicked(evt);
            }
        });

        localMusicListLabel.setBackground(new java.awt.Color(241, 241, 241));
        localMusicListLabel.setFont(new java.awt.Font("楷体", 0, 24)); // NOI18N
        localMusicListLabel.setText("本地音乐");
        localMusicListLabel.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                localMusicListLabelMouseClicked(evt);
            }
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                localMusicListLabelMouseEntered(evt);
            }
            public void mouseExited(java.awt.event.MouseEvent evt) {
                localMusicListLabelMouseExited(evt);
            }
        });

        javax.swing.GroupLayout localMusicListPanelLayout = new javax.swing.GroupLayout(localMusicListPanel);
        localMusicListPanel.setLayout(localMusicListPanelLayout);
        localMusicListPanelLayout.setHorizontalGroup(
            localMusicListPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(localMusicListPanelLayout.createSequentialGroup()
                .addGap(27, 27, 27)
                .addComponent(localMusicListIconLabel)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(localMusicListLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 200, Short.MAX_VALUE)
                .addGap(65, 65, 65))
        );
        localMusicListPanelLayout.setVerticalGroup(
            localMusicListPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(localMusicListLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addComponent(localMusicListIconLabel, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 66, Short.MAX_VALUE)
        );

        createMusicListButton.setBackground(new java.awt.Color(241, 241, 241));
        createMusicListButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/GUI/icons/addLocalToScanFolderNode.png"))); // NOI18N
        createMusicListButton.setToolTipText("创建一个歌单");
        createMusicListButton.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(241, 241, 241), 1, true));
        createMusicListButton.setContentAreaFilled(false);
        createMusicListButton.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        createMusicListButton.setFocusPainted(false);
        createMusicListButton.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                createMusicListButtonMouseClicked(evt);
            }
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                createMusicListButtonMouseEntered(evt);
            }
            public void mouseExited(java.awt.event.MouseEvent evt) {
                createMusicListButtonMouseExited(evt);
            }
        });
        createMusicListButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                createMusicListButtonActionPerformed(evt);
            }
        });

        deleteSelectedMusicLists1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/GUI/icons/delete.png"))); // NOI18N
        deleteSelectedMusicLists1.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(241, 241, 241), 1, true));
        deleteSelectedMusicLists1.setContentAreaFilled(false);
        deleteSelectedMusicLists1.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        deleteSelectedMusicLists1.setFocusPainted(false);
        deleteSelectedMusicLists1.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                deleteSelectedMusicLists1MouseClicked(evt);
            }
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                deleteSelectedMusicLists1MouseEntered(evt);
            }
            public void mouseExited(java.awt.event.MouseEvent evt) {
                deleteSelectedMusicLists1MouseExited(evt);
            }
        });
        deleteSelectedMusicLists1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                deleteSelectedMusicLists1ActionPerformed(evt);
            }
        });

        jScrollPane6.setBackground(new java.awt.Color(241, 241, 241));
        jScrollPane6.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);

        createMusicListsPanel.setBackground(new java.awt.Color(241, 241, 241));
        createMusicListsPanel.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        createMusicListsPanel.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                createMusicListsPanelMouseClicked(evt);
            }
        });
        createMusicListsPanel.setLayout(new javax.swing.BoxLayout(createMusicListsPanel, javax.swing.BoxLayout.Y_AXIS));
        jScrollPane6.setViewportView(createMusicListsPanel);

        jLabel2.setBackground(new java.awt.Color(241, 241, 241));
        jLabel2.setFont(new java.awt.Font("楷体", 0, 24)); // NOI18N
        jLabel2.setText("创建的歌单");

        javax.swing.GroupLayout musicListsPanelLayout = new javax.swing.GroupLayout(musicListsPanel);
        musicListsPanel.setLayout(musicListsPanelLayout);
        musicListsPanelLayout.setHorizontalGroup(
            musicListsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(musicListsPanelLayout.createSequentialGroup()
                .addComponent(localMusicListPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(0, 0, Short.MAX_VALUE))
            .addGroup(musicListsPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(musicListsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jScrollPane6, javax.swing.GroupLayout.PREFERRED_SIZE, 256, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(musicListsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(deleteSelectedMusicLists1, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(createMusicListButton, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(23, 23, 23))
        );
        musicListsPanelLayout.setVerticalGroup(
            musicListsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(musicListsPanelLayout.createSequentialGroup()
                .addComponent(localMusicListPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 43, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(musicListsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(musicListsPanelLayout.createSequentialGroup()
                        .addComponent(createMusicListButton, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(deleteSelectedMusicLists1, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap(459, Short.MAX_VALUE))
                    .addComponent(jScrollPane6)))
        );

        getContentPane().add(musicListsPanel, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 90, 330, 660));

        playControllerPanel.setBackground(new java.awt.Color(241, 241, 241));
        playControllerPanel.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));

        preMusicButton.setBackground(new java.awt.Color(242, 242, 242));
        preMusicButton.setFont(new java.awt.Font("楷体", 0, 24)); // NOI18N
        preMusicButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/GUI/icons/pre.png"))); // NOI18N
        preMusicButton.setToolTipText("上一首");
        preMusicButton.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(241, 241, 241), 1, true));
        preMusicButton.setContentAreaFilled(false);
        preMusicButton.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        preMusicButton.setFocusPainted(false);
        preMusicButton.setPreferredSize(new java.awt.Dimension(32, 32));
        preMusicButton.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                preMusicButtonMouseClicked(evt);
            }
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                preMusicButtonMouseEntered(evt);
            }
            public void mouseExited(java.awt.event.MouseEvent evt) {
                preMusicButtonMouseExited(evt);
            }
        });

        play_pauseButton.setBackground(new java.awt.Color(250, 250, 250));
        play_pauseButton.setFont(new java.awt.Font("楷体", 0, 24)); // NOI18N
        play_pauseButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/GUI/icons/play.png"))); // NOI18N
        play_pauseButton.setToolTipText("播放/暂停");
        play_pauseButton.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(241, 241, 241), 1, true));
        play_pauseButton.setContentAreaFilled(false);
        play_pauseButton.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        play_pauseButton.setFocusPainted(false);
        play_pauseButton.setPreferredSize(new java.awt.Dimension(32, 32));
        play_pauseButton.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                play_pauseButtonMouseClicked(evt);
            }
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                play_pauseButtonMouseEntered(evt);
            }
            public void mouseExited(java.awt.event.MouseEvent evt) {
                play_pauseButtonMouseExited(evt);
            }
        });

        nextMusicButton.setBackground(new java.awt.Color(241, 241, 241));
        nextMusicButton.setFont(new java.awt.Font("楷体", 0, 24)); // NOI18N
        nextMusicButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/GUI/icons/next.png"))); // NOI18N
        nextMusicButton.setToolTipText("下一首");
        nextMusicButton.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(241, 241, 241), 1, true));
        nextMusicButton.setContentAreaFilled(false);
        nextMusicButton.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        nextMusicButton.setFocusPainted(false);
        nextMusicButton.setPreferredSize(new java.awt.Dimension(32, 32));
        nextMusicButton.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                nextMusicButtonMouseClicked(evt);
            }
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                nextMusicButtonMouseEntered(evt);
            }
            public void mouseExited(java.awt.event.MouseEvent evt) {
                nextMusicButtonMouseExited(evt);
            }
        });
        nextMusicButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                nextMusicButtonActionPerformed(evt);
            }
        });

        musicInfoPanel.setBackground(new java.awt.Color(241, 241, 241));

        musicNameLabel.setFont(new java.awt.Font("楷体", 0, 24)); // NOI18N
        musicNameLabel.setText("音乐，你的生活！");

        musicCcoverIconLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/GUI/icons/music.png"))); // NOI18N

        currentPlayTimeJSlider.setBackground(new java.awt.Color(241, 241, 241));
        currentPlayTimeJSlider.setForeground(new java.awt.Color(241, 241, 241));
        currentPlayTimeJSlider.setPaintTicks(true);
        currentPlayTimeJSlider.setValue(0);
        currentPlayTimeJSlider.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        currentPlayTimeJSlider.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseReleased(java.awt.event.MouseEvent evt) {
                currentPlayTimeJSliderMouseReleased(evt);
            }
        });

        javax.swing.GroupLayout musicInfoPanelLayout = new javax.swing.GroupLayout(musicInfoPanel);
        musicInfoPanel.setLayout(musicInfoPanelLayout);
        musicInfoPanelLayout.setHorizontalGroup(
            musicInfoPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(musicInfoPanelLayout.createSequentialGroup()
                .addGap(45, 45, 45)
                .addComponent(musicCcoverIconLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGroup(musicInfoPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(musicInfoPanelLayout.createSequentialGroup()
                        .addGap(57, 57, 57)
                        .addComponent(musicNameLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, musicInfoPanelLayout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 57, Short.MAX_VALUE)
                        .addComponent(currentPlayTimeJSlider, javax.swing.GroupLayout.PREFERRED_SIZE, 481, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
        );
        musicInfoPanelLayout.setVerticalGroup(
            musicInfoPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(musicInfoPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(musicNameLabel)
                .addGap(18, 18, 18)
                .addComponent(currentPlayTimeJSlider, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
            .addComponent(musicCcoverIconLabel, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );

        playModeButton.setBackground(new java.awt.Color(241, 241, 241));
        playModeButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/GUI/icons/sequence.png"))); // NOI18N
        playModeButton.setToolTipText("顺序播放");
        playModeButton.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(241, 241, 241), 1, true));
        playModeButton.setContentAreaFilled(false);
        playModeButton.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        playModeButton.setFocusPainted(false);
        playModeButton.setPreferredSize(new java.awt.Dimension(32, 32));
        playModeButton.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                playModeButtonMouseClicked(evt);
            }
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                playModeButtonMouseEntered(evt);
            }
            public void mouseExited(java.awt.event.MouseEvent evt) {
                playModeButtonMouseExited(evt);
            }
        });

        currentPlayTimeJLabel.setFont(new java.awt.Font("楷体", 0, 24)); // NOI18N
        currentPlayTimeJLabel.setText("00:00/00:00");

        javax.swing.GroupLayout playControllerPanelLayout = new javax.swing.GroupLayout(playControllerPanel);
        playControllerPanel.setLayout(playControllerPanelLayout);
        playControllerPanelLayout.setHorizontalGroup(
            playControllerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(playControllerPanelLayout.createSequentialGroup()
                .addComponent(musicInfoPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(preMusicButton, javax.swing.GroupLayout.PREFERRED_SIZE, 58, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(play_pauseButton, javax.swing.GroupLayout.PREFERRED_SIZE, 67, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(nextMusicButton, javax.swing.GroupLayout.PREFERRED_SIZE, 58, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(playModeButton, javax.swing.GroupLayout.PREFERRED_SIZE, 46, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 363, Short.MAX_VALUE)
                .addComponent(currentPlayTimeJLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 190, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(32, 32, 32))
        );
        playControllerPanelLayout.setVerticalGroup(
            playControllerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(musicInfoPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addGroup(playControllerPanelLayout.createSequentialGroup()
                .addGap(23, 23, 23)
                .addGroup(playControllerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(playModeButton, javax.swing.GroupLayout.DEFAULT_SIZE, 57, Short.MAX_VALUE)
                    .addComponent(nextMusicButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(play_pauseButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(preMusicButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(currentPlayTimeJLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        getContentPane().add(playControllerPanel, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 750, 1570, 110));

        musicListInfoPanel.setBackground(new java.awt.Color(243, 243, 243));

        currentVisitMusicListLabel.setFont(new java.awt.Font("楷体", 1, 36)); // NOI18N
        currentVisitMusicListLabel.setText("本地音乐");

        addLocalToScanFolderNodeButton.setBackground(new java.awt.Color(243, 243, 243));
        addLocalToScanFolderNodeButton.setFont(new java.awt.Font("楷体", 0, 24)); // NOI18N
        addLocalToScanFolderNodeButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/GUI/icons/addLocalToScanFolderNode.png"))); // NOI18N
        addLocalToScanFolderNodeButton.setText("选择目录");
        addLocalToScanFolderNodeButton.setToolTipText("添加一个等待扫描的文件夹");
        addLocalToScanFolderNodeButton.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(243, 243, 243), 1, true));
        addLocalToScanFolderNodeButton.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        addLocalToScanFolderNodeButton.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                addLocalToScanFolderNodeButtonMouseClicked(evt);
            }
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                addLocalToScanFolderNodeButtonMouseEntered(evt);
            }
            public void mouseExited(java.awt.event.MouseEvent evt) {
                addLocalToScanFolderNodeButtonMouseExited(evt);
            }
        });

        matchMusicButton.setBackground(new java.awt.Color(243, 243, 243));
        matchMusicButton.setFont(new java.awt.Font("楷体", 0, 24)); // NOI18N
        matchMusicButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/GUI/icons/match.png"))); // NOI18N
        matchMusicButton.setText("匹配音乐");
        matchMusicButton.setToolTipText("匹配所选文件夹中MP3文件");
        matchMusicButton.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(243, 243, 243), 1, true));
        matchMusicButton.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        matchMusicButton.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                matchMusicButtonMouseClicked(evt);
            }
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                matchMusicButtonMouseEntered(evt);
            }
            public void mouseExited(java.awt.event.MouseEvent evt) {
                matchMusicButtonMouseExited(evt);
            }
        });

        javax.swing.GroupLayout musicListInfoPanelLayout = new javax.swing.GroupLayout(musicListInfoPanel);
        musicListInfoPanel.setLayout(musicListInfoPanelLayout);
        musicListInfoPanelLayout.setHorizontalGroup(
            musicListInfoPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(musicListInfoPanelLayout.createSequentialGroup()
                .addGap(12, 12, 12)
                .addComponent(currentVisitMusicListLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 893, Short.MAX_VALUE)
                .addGap(18, 18, 18)
                .addComponent(addLocalToScanFolderNodeButton)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(matchMusicButton)
                .addGap(38, 38, 38))
        );
        musicListInfoPanelLayout.setVerticalGroup(
            musicListInfoPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(musicListInfoPanelLayout.createSequentialGroup()
                .addGap(26, 26, 26)
                .addGroup(musicListInfoPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(currentVisitMusicListLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 56, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(musicListInfoPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(addLocalToScanFolderNodeButton)
                        .addComponent(matchMusicButton)))
                .addContainerGap(26, Short.MAX_VALUE))
        );

        getContentPane().add(musicListInfoPanel, new org.netbeans.lib.awtextra.AbsoluteConstraints(330, 80, 1240, -1));

        mainPanel.setBackground(new java.awt.Color(250, 250, 250));

        functionPanel.setBackground(new java.awt.Color(250, 250, 250));

        searchInLocalMusicListTextFiled.setBackground(new java.awt.Color(235, 235, 235));
        searchInLocalMusicListTextFiled.setFont(new java.awt.Font("楷体", 0, 24)); // NOI18N
        searchInLocalMusicListTextFiled.setForeground(new java.awt.Color(154, 154, 154));
        searchInLocalMusicListTextFiled.setText("搜索乐曲");
        searchInLocalMusicListTextFiled.setBorder(null);
        searchInLocalMusicListTextFiled.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusGained(java.awt.event.FocusEvent evt) {
                searchInLocalMusicListTextFiledFocusGained(evt);
            }
            public void focusLost(java.awt.event.FocusEvent evt) {
                searchInLocalMusicListTextFiledFocusLost(evt);
            }
        });
        searchInLocalMusicListTextFiled.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                searchInLocalMusicListTextFiledActionPerformed(evt);
            }
        });
        searchInLocalMusicListTextFiled.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyReleased(java.awt.event.KeyEvent evt) {
                searchInLocalMusicListTextFiledKeyReleased(evt);
            }
        });

        sortByCombox.setBackground(new java.awt.Color(250, 250, 250));
        sortByCombox.setFont(new java.awt.Font("楷体", 0, 24)); // NOI18N
        sortByCombox.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "默认排序", "歌曲名", "歌手", "专辑" }));
        sortByCombox.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(250, 250, 250), 1, true));
        sortByCombox.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        sortByCombox.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                sortByComboxItemStateChanged(evt);
            }
        });
        sortByCombox.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                sortByComboxMouseClicked(evt);
            }
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                sortByComboxMouseEntered(evt);
            }
            public void mouseExited(java.awt.event.MouseEvent evt) {
                sortByComboxMouseExited(evt);
            }
        });

        defaultListButton.setBackground(new java.awt.Color(251, 251, 251));
        defaultListButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/GUI/icons/defaultList.png"))); // NOI18N
        defaultListButton.setToolTipText("列表视图");
        defaultListButton.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(241, 241, 241), 1, true));
        defaultListButton.setContentAreaFilled(false);
        defaultListButton.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        defaultListButton.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                defaultListButtonMouseClicked(evt);
            }
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                defaultListButtonMouseEntered(evt);
            }
            public void mouseExited(java.awt.event.MouseEvent evt) {
                defaultListButtonMouseExited(evt);
            }
        });

        artistButton.setBackground(new java.awt.Color(250, 250, 250));
        artistButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/GUI/icons/artist.png"))); // NOI18N
        artistButton.setToolTipText("歌手视图");
        artistButton.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(250, 250, 250), 1, true));
        artistButton.setContentAreaFilled(false);
        artistButton.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        artistButton.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                artistButtonMouseClicked(evt);
            }
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                artistButtonMouseEntered(evt);
            }
            public void mouseExited(java.awt.event.MouseEvent evt) {
                artistButtonMouseExited(evt);
            }
        });

        albumButton.setBackground(new java.awt.Color(250, 250, 250));
        albumButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/GUI/icons/album.png"))); // NOI18N
        albumButton.setToolTipText("专辑视图");
        albumButton.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(250, 250, 250), 1, true));
        albumButton.setContentAreaFilled(false);
        albumButton.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        albumButton.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                albumButtonMouseClicked(evt);
            }
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                albumButtonMouseEntered(evt);
            }
            public void mouseExited(java.awt.event.MouseEvent evt) {
                albumButtonMouseExited(evt);
            }
        });

        localListButton.setBackground(new java.awt.Color(250, 250, 250));
        localListButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/GUI/icons/local.png"))); // NOI18N
        localListButton.setToolTipText("本地文件夹视图");
        localListButton.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(250, 250, 250), 1, true));
        localListButton.setContentAreaFilled(false);
        localListButton.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        localListButton.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                localListButtonMouseClicked(evt);
            }
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                localListButtonMouseEntered(evt);
            }
            public void mouseExited(java.awt.event.MouseEvent evt) {
                localListButtonMouseExited(evt);
            }
        });

        searchLocalMusicLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/GUI/icons/search.png"))); // NOI18N
        searchLocalMusicLabel.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        searchLocalMusicLabel.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                searchLocalMusicLabelMouseEntered(evt);
            }
            public void mouseExited(java.awt.event.MouseEvent evt) {
                searchLocalMusicLabelMouseExited(evt);
            }
        });

        javax.swing.GroupLayout functionPanelLayout = new javax.swing.GroupLayout(functionPanel);
        functionPanel.setLayout(functionPanelLayout);
        functionPanelLayout.setHorizontalGroup(
            functionPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(functionPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(searchInLocalMusicListTextFiled, javax.swing.GroupLayout.PREFERRED_SIZE, 412, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(15, 15, 15)
                .addComponent(searchLocalMusicLabel)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(sortByCombox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(defaultListButton, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(artistButton, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(albumButton, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(localListButton, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(35, 35, 35))
        );
        functionPanelLayout.setVerticalGroup(
            functionPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(functionPanelLayout.createSequentialGroup()
                .addGap(20, 20, 20)
                .addGroup(functionPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(artistButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(albumButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(localListButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(searchLocalMusicLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 41, Short.MAX_VALUE)
                    .addComponent(sortByCombox, javax.swing.GroupLayout.DEFAULT_SIZE, 41, Short.MAX_VALUE)
                    .addComponent(defaultListButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(searchInLocalMusicListTextFiled))
                .addContainerGap(31, Short.MAX_VALUE))
        );

        listPanel.setBackground(new java.awt.Color(250, 250, 250));
        listPanel.setLayout(new java.awt.CardLayout());

        classifyPanel.setBackground(new java.awt.Color(250, 250, 250));

        classifyMusicListTabel.setFont(new java.awt.Font("楷体", 0, 24)); // NOI18N
        classifyMusicListTabel.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "歌曲", "歌手", "专辑", "时长", "文件路径"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class
            };
            boolean[] canEdit = new boolean [] {
                false, false, false, false, false
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        classifyMusicListTabel.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        classifyMusicListTabel.setRowHeight(48);
        classifyMusicListTabel.setSelectionBackground(new java.awt.Color(135, 206, 235));
        classifyMusicListTabel.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                classifyMusicListTabelMouseClicked(evt);
            }
        });
        jScrollPane5.setViewportView(classifyMusicListTabel);

        jScrollPane1.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
        jScrollPane1.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);

        classifyListPanel.setBackground(new java.awt.Color(250, 250, 250));
        classifyListPanel.setLayout(new javax.swing.BoxLayout(classifyListPanel, javax.swing.BoxLayout.Y_AXIS));
        jScrollPane1.setViewportView(classifyListPanel);

        searchLocalMusicLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/GUI/icons/search.png"))); // NOI18N
        searchLocalMusicLabel1.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        searchLocalMusicLabel1.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                searchLocalMusicLabel1MouseEntered(evt);
            }
            public void mouseExited(java.awt.event.MouseEvent evt) {
                searchLocalMusicLabel1MouseExited(evt);
            }
        });

        searchInLocalMusicListsTextFiled.setBackground(new java.awt.Color(235, 235, 235));
        searchInLocalMusicListsTextFiled.setFont(new java.awt.Font("楷体", 0, 24)); // NOI18N
        searchInLocalMusicListsTextFiled.setForeground(new java.awt.Color(154, 154, 154));
        searchInLocalMusicListsTextFiled.setText("搜索歌单");
        searchInLocalMusicListsTextFiled.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusGained(java.awt.event.FocusEvent evt) {
                searchInLocalMusicListsTextFiledFocusGained(evt);
            }
            public void focusLost(java.awt.event.FocusEvent evt) {
                searchInLocalMusicListsTextFiledFocusLost(evt);
            }
        });
        searchInLocalMusicListsTextFiled.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyReleased(java.awt.event.KeyEvent evt) {
                searchInLocalMusicListsTextFiledKeyReleased(evt);
            }
        });

        javax.swing.GroupLayout classifyPanelLayout = new javax.swing.GroupLayout(classifyPanel);
        classifyPanel.setLayout(classifyPanelLayout);
        classifyPanelLayout.setHorizontalGroup(
            classifyPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, classifyPanelLayout.createSequentialGroup()
                .addGroup(classifyPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(classifyPanelLayout.createSequentialGroup()
                        .addGap(0, 0, Short.MAX_VALUE)
                        .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 286, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(classifyPanelLayout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(searchInLocalMusicListsTextFiled, javax.swing.GroupLayout.PREFERRED_SIZE, 229, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(searchLocalMusicLabel1)
                        .addGap(0, 0, Short.MAX_VALUE)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane5, javax.swing.GroupLayout.PREFERRED_SIZE, 945, javax.swing.GroupLayout.PREFERRED_SIZE))
        );
        classifyPanelLayout.setVerticalGroup(
            classifyPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane5)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, classifyPanelLayout.createSequentialGroup()
                .addGap(6, 6, 6)
                .addGroup(classifyPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(searchLocalMusicLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(searchInLocalMusicListsTextFiled))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 414, javax.swing.GroupLayout.PREFERRED_SIZE))
        );

        listPanel.add(classifyPanel, "card2");

        jScrollPane2.setBackground(new java.awt.Color(250, 250, 250));

        musicListTabel.setFont(new java.awt.Font("楷体", 0, 24)); // NOI18N
        musicListTabel.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "歌曲", "歌手", "专辑", "时长"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class
            };
            boolean[] canEdit = new boolean [] {
                false, false, false, false
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        musicListTabel.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        musicListTabel.setRowHeight(48);
        musicListTabel.setSelectionBackground(new java.awt.Color(135, 206, 235));
        musicListTabel.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                musicListTabelMouseClicked(evt);
            }
        });
        jScrollPane2.setViewportView(musicListTabel);

        listPanel.add(jScrollPane2, "card1");

        javax.swing.GroupLayout mainPanelLayout = new javax.swing.GroupLayout(mainPanel);
        mainPanel.setLayout(mainPanelLayout);
        mainPanelLayout.setHorizontalGroup(
            mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(functionPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addComponent(listPanel, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        mainPanelLayout.setVerticalGroup(
            mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(mainPanelLayout.createSequentialGroup()
                .addComponent(functionPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(listPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        getContentPane().add(mainPanel, new org.netbeans.lib.awtextra.AbsoluteConstraints(330, 190, 1240, 560));

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void musicListsPanelMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_musicListsPanelMouseClicked
        // TODO add your handling code here:
        
    }//GEN-LAST:event_musicListsPanelMouseClicked

    private void localMusicListPanelMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_localMusicListPanelMouseClicked
        localMusicListPanelActionPerformed();
    }//GEN-LAST:event_localMusicListPanelMouseClicked

    private void localMusicListLabelMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_localMusicListLabelMouseClicked
         localMusicListPanelActionPerformed();
    }//GEN-LAST:event_localMusicListLabelMouseClicked

    private void localMusicListIconLabelMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_localMusicListIconLabelMouseClicked
        localMusicListPanelActionPerformed();
    }//GEN-LAST:event_localMusicListIconLabelMouseClicked

    private void localMusicListPanelActionPerformed(){
        addLocalToScanFolderNodeButton.setVisible(true);
         matchMusicButton.setVisible(true);
         //设置当前访问的歌单集合以及歌单
         //此时访问的是本地歌单，显然没有歌单集合一说
         LinkedListManager.getInstance().setCurrentVisitMusicLists(null);
         LinkedListManager.getInstance().setCurrentVisitMusicList(LinkedListManager.getInstance().getLocalListNode());
         //更新currentVisitMusicListLabel
         currentVisitMusicListLabel.setText("本地音乐");
          //为中间变量赋值
         transientCurrentVisitMusicLists = LinkedListManager.getInstance().getCurrentVisitMusicLists();
         transientCurrentVisitMusicList = LinkedListManager.getInstance().getCurrentVisitMusicList();
         //将本地歌单数据写入到JTable中
         printMusicList(musicListTabel);
    }
    
    private void minmumButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_minmumButtonActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_minmumButtonActionPerformed

    private void closeButtonMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_closeButtonMouseEntered
        // TODO add your handling code here:
        Icon icon = new ImageIcon(getClass().getResource("/GUI/icons/close_colour.png"));
        closeButton.setIcon(icon);
    }//GEN-LAST:event_closeButtonMouseEntered

    private void closeButtonMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_closeButtonMouseExited
        // TODO add your handling code here:
        Icon icon = new ImageIcon(getClass().getResource("/GUI/icons/close.png"));
        closeButton.setIcon(icon);
    }//GEN-LAST:event_closeButtonMouseExited

    private void minmumButtonMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_minmumButtonMouseEntered
        // TODO add your handling code here:
        Icon icon = new ImageIcon(getClass().getResource("/GUI/icons/delete_colour.png"));
        minmumButton.setIcon(icon);
    }//GEN-LAST:event_minmumButtonMouseEntered

    private void minmumButtonMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_minmumButtonMouseExited
        // TODO add your handling code here:
        Icon icon = new ImageIcon(getClass().getResource("/GUI/icons/delete.png"));
        minmumButton.setIcon(icon);
    }//GEN-LAST:event_minmumButtonMouseExited

    private void nextMusicButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_nextMusicButtonActionPerformed
        // TODO add your handling code here:
        
    }//GEN-LAST:event_nextMusicButtonActionPerformed

    private void preMusicButtonMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_preMusicButtonMouseEntered
        // TODO add your handling code here:
        java.net.URL imgURL = getClass().getResource("/GUI/icons/pre_colour.png");
        preMusicButton.setIcon(new ImageIcon(imgURL));
    }//GEN-LAST:event_preMusicButtonMouseEntered

    private void preMusicButtonMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_preMusicButtonMouseExited
        // TODO add your handling code here:
        java.net.URL imgURL = getClass().getResource("/GUI/icons/pre.png");
        preMusicButton.setIcon(new ImageIcon(imgURL));
    }//GEN-LAST:event_preMusicButtonMouseExited

    private void play_pauseButtonMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_play_pauseButtonMouseEntered
        // TODO add your handling code here:
        Icon icon = null;
        switch(play_pauseButtonClickedCount){
            case 0:{
                icon =  new ImageIcon(getClass().getResource("/GUI/icons/play_colour.png"));
                break;
            }
            case 1:{
                 icon =  new ImageIcon(getClass().getResource("/GUI/icons/pause_colour.png"));
                break;
            }
        }
        play_pauseButton.setIcon(icon);
    }//GEN-LAST:event_play_pauseButtonMouseEntered

    private void play_pauseButtonMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_play_pauseButtonMouseExited
        // TODO add your handling code here:
        Icon icon = null;
        switch(play_pauseButtonClickedCount){
            case 0:{
                icon =  new ImageIcon(getClass().getResource("/GUI/icons/play.png"));
                break;
            }
            case 1:{
                 icon =  new ImageIcon(getClass().getResource("/GUI/icons/pause.png"));
                break;
            }
        }
        play_pauseButton.setIcon(icon);
    }//GEN-LAST:event_play_pauseButtonMouseExited

    private void nextMusicButtonMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_nextMusicButtonMouseEntered
        // TODO add your handling code here:
        java.net.URL imgURL = getClass().getResource("/GUI/icons/next_colour.png");
        nextMusicButton.setIcon(new ImageIcon(imgURL));
    }//GEN-LAST:event_nextMusicButtonMouseEntered

    private void nextMusicButtonMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_nextMusicButtonMouseExited
        // TODO add your handling code here:
        java.net.URL imgURL = getClass().getResource("/GUI/icons/next.png");
        nextMusicButton.setIcon(new ImageIcon(imgURL));
    }//GEN-LAST:event_nextMusicButtonMouseExited

    private void sortByComboxMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_sortByComboxMouseEntered
        // TODO add your handling code here:
        //sortByCombox.setBackground(new Color(52,152,219));
    }//GEN-LAST:event_sortByComboxMouseEntered

    private void sortByComboxMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_sortByComboxMouseExited
        // TODO add your handling code here:
        //sortByCombox.setBackground(new Color(250,250,250));
    }//GEN-LAST:event_sortByComboxMouseExited

    public static int playModeButtonClickedCount = 0;
   
    private void playModeButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_playModeButtonMouseClicked
        // TODO add your handling code here:
        if (PlayScheduleManager.getInstance().currentPlayMusicList != null) {
            playModeButtonClickedCount++;
            playModeButtonClickedCount = playModeButtonClickedCount % 3;
            java.net.URL imgURL = null;
            switch(playModeButtonClickedCount){
                case 0:{
                    imgURL = getClass().getResource("/GUI/icons/sequence.png");
                    playModeButton.setToolTipText("顺序播放");
                    PlayScheduleManager.getInstance().setPlayMode(PlayMode.SEQUENCE);
                    break;
                }
                case 1:{
                     imgURL = getClass().getResource("/GUI/icons/random.png");
                     playModeButton.setToolTipText("随机播放");
                     PlayScheduleManager.getInstance().setPlayMode(PlayMode.RANDOM);
                    break;
                }
                case 2:{
                     imgURL = getClass().getResource("/GUI/icons/singleCycle.png");
                     playModeButton.setToolTipText("单曲循环");
                     PlayScheduleManager.getInstance().setPlayMode(PlayMode.SINGLE_CYCLE);
                    break;
                }
            }
            playModeButton.setIcon(new ImageIcon(imgURL));
        }
    }//GEN-LAST:event_playModeButtonMouseClicked

    private void preMusicButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_preMusicButtonMouseClicked
        if (PlayScheduleManager.getInstance().currentPlayMusicList != null) {
           MusicPlayer.musicPlayer.playMp3FileImmediately(PlayScheduleManager.getInstance().getPrePlayDefault().info.getFilePath());
           musicNameLabel.setText(PlayScheduleManager.getInstance().pCurrentPlayMusicNodeCopy.info.getSongName());
           //设置currentPlayTimeJSlider以及currentPlayTimeJLabel
            currentPlayTimeJSlider.setMaximum(PlayScheduleManager.getInstance().pCurrentPlayMusicNodeCopy.info.getTime_Int());
            currentPlayTimeJSlider.setValue(0);
            currentPlayTimeJLabel.setText("00:00" +  "/" + PlayScheduleManager.getInstance().pCurrentPlayMusicNodeCopy.info.getTime_String());
            //重置播放进度条线程的currentPlayTime
            MusicPlayer.currentPlayTime = 0;
        }
    }//GEN-LAST:event_preMusicButtonMouseClicked

    public static int play_pauseButtonClickedCount = 0;
    
    private void play_pauseButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_play_pauseButtonMouseClicked
        if (PlayScheduleManager.getInstance().currentPlayMusicList != null) {
                play_pauseButtonClickedCount++;
               play_pauseButtonClickedCount = play_pauseButtonClickedCount % 2;
                java.net.URL imgURL = null;
               switch(play_pauseButtonClickedCount){
                   case 0:{
                        imgURL = getClass().getResource("/GUI/icons/play_colour.png");
                        MusicPlayerUI_Tray.getInstance().play_pause.setIcon((new ImageIcon(getClass().getResource("/GUI/icons/play.png"))));
                        //执行暂停播放
                        MusicPlayer.musicPlayer.pausePlay();
                        MusicPlayerUI_Tray.getInstance().play_pause.setText("播放");
                       break;
                   }
                   case 1:{
                        imgURL = getClass().getResource("/GUI/icons/pause_colour.png");
                        MusicPlayerUI_Tray.getInstance().play_pause.setIcon(new ImageIcon(getClass().getResource("/GUI/icons/pause.png")));
                        //执行继续播放
                       MusicPlayer.musicPlayer.continuePlay();
                       MusicPlayerUI_Tray.getInstance().play_pause.setText("暂停");
                       break;
                   }
               }
               play_pauseButton.setIcon(new ImageIcon(imgURL));
        }
    }//GEN-LAST:event_play_pauseButtonMouseClicked

    private void playModeButtonMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_playModeButtonMouseEntered
        java.net.URL imgURL = null;
        switch(playModeButtonClickedCount){
            case 0:{
                imgURL = getClass().getResource("/GUI/icons/sequence_colour.png");
                break;
            }
            case 1:{
                 imgURL = getClass().getResource("/GUI/icons/random_colour.png");
                 break;
            }
            case 2:{
                imgURL = getClass().getResource("/GUI/icons/singleCycle_colour.png");
                break;
            }
        }
        playModeButton.setIcon(new ImageIcon(imgURL));
    }//GEN-LAST:event_playModeButtonMouseEntered

    private void playModeButtonMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_playModeButtonMouseExited
        Icon icon = null;
        switch(playModeButtonClickedCount){
            case 0:{
                 icon = new ImageIcon(getClass().getResource("/GUI/icons/sequence.png"));
                break;
            }
            case 1:{
                 icon = new ImageIcon(getClass().getResource("/GUI/icons/random.png"));
                break;
            }
            case 2:{
                 icon = new ImageIcon(getClass().getResource("/GUI/icons/singleCycle.png"));
                break;
            }
        }
        playModeButton.setIcon(icon);
    }//GEN-LAST:event_playModeButtonMouseExited

    private void localMusicListLabelMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_localMusicListLabelMouseEntered
        // TODO add your handling code here:
        localMusicListPanel.setBackground(Color.LIGHT_GRAY);
    }//GEN-LAST:event_localMusicListLabelMouseEntered

    private void localMusicListLabelMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_localMusicListLabelMouseExited
        // TODO add your handling code here:
        localMusicListPanel.setBackground(new Color(241,241,241));
    }//GEN-LAST:event_localMusicListLabelMouseExited

    private void artistButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_artistButtonMouseClicked
        CardLayout card = (CardLayout)listPanel.getLayout();
        card.show(listPanel,"card2");
        currentCard = "card2";
        searchInLocalMusicListTextFiled.setEditable(false);
        searchInLocalMusicListTextFiled.setBackground(new Color(250,250,250));
        searchInLocalMusicListTextFiled.setForeground(new Color(0,0,0));
        searchInLocalMusicListTextFiled.setFont(new Font("楷体",Font.BOLD,24));
        searchLocalMusicLabel.setVisible(false);
       classifyButtonActionPerformed(ClassifyBy.ARTIST);
    }//GEN-LAST:event_artistButtonMouseClicked

    private void albumButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_albumButtonMouseClicked
        // TODO add your handling code here:
         CardLayout card = (CardLayout)listPanel.getLayout();
        card.show(listPanel,"card2");
        currentCard = "card2";
        searchInLocalMusicListTextFiled.setEditable(false);
        searchInLocalMusicListTextFiled.setBackground(new Color(250,250,250));
        searchInLocalMusicListTextFiled.setForeground(new Color(0,0,0));
        searchInLocalMusicListTextFiled.setFont(new Font("楷体",Font.BOLD,24));
        searchLocalMusicLabel.setVisible(false);
        classifyButtonActionPerformed(ClassifyBy.ALBUM);
    }//GEN-LAST:event_albumButtonMouseClicked

    private void localListButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_localListButtonMouseClicked
        // TODO add your handling code here:
         CardLayout card = (CardLayout)listPanel.getLayout();
        card.show(listPanel,"card2");
        currentCard = "card2";
        searchInLocalMusicListTextFiled.setEditable(false);
        searchInLocalMusicListTextFiled.setBackground(new Color(250,250,250));
        searchInLocalMusicListTextFiled.setForeground(new Color(0,0,0));
        searchInLocalMusicListTextFiled.setFont(new Font("楷体",Font.BOLD,24));
        searchLocalMusicLabel.setVisible(false);
        classifyButtonActionPerformed(ClassifyBy.PATH);
    }//GEN-LAST:event_localListButtonMouseClicked

    private void classifyButtonActionPerformed(ClassifyBy classifyBy){
        //清空classifyMusicListTabel
        DefaultTableModel model = (DefaultTableModel)classifyMusicListTabel.getModel();
        model.getDataVector().clear();   //清除表格数据
        model.fireTableDataChanged();//通知模型更新
        classifyMusicListTabel.updateUI();
        //置空classifyListPanel
        classifyListPanel.removeAll();
        classifyListPanel.updateUI();
        //重置当前访问的链表集合以及链表
        LinkedListManager.getInstance().setCurrentVisitMusicLists(transientCurrentVisitMusicLists);
        LinkedListManager.getInstance().setCurrentVisitMusicList(transientCurrentVisitMusicList);
        //对链表按照classifyBy执行分类
        MusicLists classifyMusicLists = LinkedListManager.getInstance().classify(classifyBy);
        transientClassifyCurrentVisitMusicLists = classifyMusicLists;
        //修改当前访问的链表集合
        LinkedListManager.getInstance().setCurrentVisitMusicLists(classifyMusicLists);
        LinkedListManager.getInstance().setCurrentVisitMusicList(null);
        //重置UI
        if (classifyMusicLists != null) {
            Node<MusicListNode> listNode = classifyMusicLists.head;
            while(listNode != null){
                JLabel newLabel = new JLabel(listNode.info.toString());
                newLabel.setFont(new java.awt.Font("楷体", 0, 24));
                newLabel.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
                newLabel.setBackground(new Color(250,250,250));
                newLabel.addMouseListener(new MouseAdapter(){
                            @Override
                            public void mouseClicked(MouseEvent e) {
                                  //修改当前访问的链表
                                 LinkedListManager.getInstance().setCurrentVisitMusicList(LinkedListManager.getInstance().findSetectedMusicList(classifyMusicLists, newLabel.getText()));
                                 //将数据写入classifyMusicListTabel
                                 printMusicList(classifyMusicListTabel);
                            }
                });
                classifyListPanel.add(newLabel);
                classifyListPanel.revalidate();
                listNode = listNode.next;
            }
        }
    }
    
    private void defaultListButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_defaultListButtonMouseClicked
        // TODO add your handling code here:
         CardLayout card = (CardLayout)listPanel.getLayout();
        card.show(listPanel,"card1");
        currentCard = "card1";
        searchInLocalMusicListTextFiled.setText("");
        searchInLocalMusicListTextFiled.setEditable(true);
        searchInLocalMusicListTextFiled.setBackground(new Color(235,235,235));
        searchInLocalMusicListTextFiled.setForeground(new Color(154,154,154));
        searchInLocalMusicListTextFiled.setFont(new Font("楷体",0,24));
        searchLocalMusicLabel.setVisible(true);
         //重置当前访问的链表集合以及链表
        LinkedListManager.getInstance().setCurrentVisitMusicLists(transientCurrentVisitMusicLists);
        LinkedListManager.getInstance().setCurrentVisitMusicList(transientCurrentVisitMusicList);
        printMusicList(musicListTabel);
    }//GEN-LAST:event_defaultListButtonMouseClicked

    private void titleBarPanelMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_titleBarPanelMousePressed
        // TODO add your handling code here:
        locationX = evt.getX();
        locationY = evt.getY();
    }//GEN-LAST:event_titleBarPanelMousePressed

    private void titleBarPanelMouseDragged(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_titleBarPanelMouseDragged
        // TODO add your handling code here:
        int left = ui.getLocation().x;
        int top = ui.getLocation().y;
        ui.setLocation(left + evt.getX() - locationX, top + evt.getY() - locationY);
    }//GEN-LAST:event_titleBarPanelMouseDragged

    private void iconPanelMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_iconPanelMousePressed
        // TODO add your handling code here:
        locationX = evt.getX();
        locationY = evt.getY();
    }//GEN-LAST:event_iconPanelMousePressed

    private void iconPanelMouseDragged(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_iconPanelMouseDragged
        // TODO add your handling code here:
        int left = ui.getLocation().x;
        int top = ui.getLocation().y;
        ui.setLocation(left + evt.getX() - locationX, top + evt.getY() - locationY);
    }//GEN-LAST:event_iconPanelMouseDragged

    private void createMusicListButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_createMusicListButtonActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_createMusicListButtonActionPerformed

    private void deleteSelectedMusicLists1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deleteSelectedMusicLists1ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_deleteSelectedMusicLists1ActionPerformed

    private void musicListTabelMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_musicListTabelMouseClicked
        //通过点击位置找到当前点击的是第几行
        int focusedRowIndex = musicListTabel.rowAtPoint(evt.getPoint());
        if (focusedRowIndex == -1) {
             return;
        }
        focusedRowIndex++;
        //1.当鼠标右键点击时
        if (evt.getButton() == MouseEvent.BUTTON3) {
            JPopupMenu popupMenu = createJPopupMenu(focusedRowIndex);
            popupMenu.show(musicListTabel,evt.getX(),evt.getY());
        }
        //2.当鼠标左键双击的时候
        else if (evt.getButton() == MouseEvent.BUTTON1 && evt.getClickCount() == 2) {
            --focusedRowIndex;
            //找到所选择的歌曲结点
            Node<MusicNode> selectedMusicNode = LinkedListManager.getInstance().getCurrentVisitMusicList().info.head;
            while(focusedRowIndex != 0){
                selectedMusicNode = selectedMusicNode.next;
                --focusedRowIndex;
            }
            //更新musicNameLabel
            musicNameLabel.setText(selectedMusicNode.info.getSongName());
            //设置currentPlayTimeJSlider以及currentPlayTimeJLabel
            currentPlayTimeJSlider.setMaximum(selectedMusicNode.info.getTime_Int());
            currentPlayTimeJSlider.setValue(0);
            currentPlayTimeJLabel.setText("00:00" +  "/" + selectedMusicNode.info.getTime_String());
            //重置播放进度条线程的currentPlayTime
            MusicPlayer.currentPlayTime = 0;
            //更新play_pauseButton的图标
            play_pauseButtonClickedCount = 1;
            Icon icon = new ImageIcon(getClass().getResource("/GUI/icons/pause.png"));
            play_pauseButton.setIcon(icon);
            //更新系统托盘的图标
            MusicPlayerUI_Tray.getInstance().play_pause.setIcon(icon);
            MusicPlayerUI_Tray.getInstance().play_pause.setText("暂停");
            //执行播放
            PlayScheduleManager.getInstance().playImmediately(selectedMusicNode);
        }
    }//GEN-LAST:event_musicListTabelMouseClicked

    private void classifyMusicListTabelMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_classifyMusicListTabelMouseClicked
        //通过点击位置找到当前点击的是第几行
        int focusedRowIndex = musicListTabel.rowAtPoint(evt.getPoint());
        if (focusedRowIndex == -1) {
             return;
        }
        focusedRowIndex++;
        //1.当鼠标右键点击时
        if (evt.getButton() == MouseEvent.BUTTON3) {
            JPopupMenu popupMenu = createJPopupMenu(focusedRowIndex);
            popupMenu.remove(2);//为了避免麻烦，此时不允许删除歌曲
            popupMenu.show(classifyMusicListTabel,evt.getX(),evt.getY());
        }
        //2.当鼠标左键双击的时候
        else if (evt.getButton() == MouseEvent.BUTTON1 && evt.getClickCount() == 2) {
            //找到所选择的歌曲结点
            --focusedRowIndex;
            Node<MusicNode> selectedMusicNode = LinkedListManager.getInstance().getCurrentVisitMusicList().info.head;
            while(focusedRowIndex != 0){
                selectedMusicNode = selectedMusicNode.next;
                --focusedRowIndex;
            }
            //更新musicNameLabel
            musicNameLabel.setText(selectedMusicNode.info.getSongName());
            //设置currentPlayTimeJSlider以及currentPlayTimeJLabel
            currentPlayTimeJSlider.setMaximum(selectedMusicNode.info.getTime_Int());
            currentPlayTimeJSlider.setValue(0);
            currentPlayTimeJLabel.setText("00:00" +  "/" + selectedMusicNode.info.getTime_String());
            //重置播放进度条线程的currentPlayTime
            MusicPlayer.currentPlayTime = 0;
            //更新play_pauseButton的图标
            play_pauseButtonClickedCount = 1;
            //MusicPlayerUI.class.getClassLoader().getResource("")
            Icon icon = new ImageIcon(getClass().getResource("/GUI/icons/pause.png"));
            play_pauseButton.setIcon(icon);
            //更新系统托盘的图标
            MusicPlayerUI_Tray.getInstance().play_pause.setIcon(icon);
            MusicPlayerUI_Tray.getInstance().play_pause.setText("暂停");
            //执行播放
            PlayScheduleManager.getInstance().playImmediately(selectedMusicNode);
        }
    }//GEN-LAST:event_classifyMusicListTabelMouseClicked

    private void createMusicListButtonMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_createMusicListButtonMouseEntered
        // TODO add your handling code here:
        Icon icon = new ImageIcon(getClass().getResource("/GUI/icons/add_colour.png"));
        createMusicListButton.setIcon(icon);
    }//GEN-LAST:event_createMusicListButtonMouseEntered

    private void createMusicListButtonMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_createMusicListButtonMouseExited
        // TODO add your handling code here:
         Icon icon = new ImageIcon(getClass().getResource("/GUI/icons/addLocalToScanFolderNode.png"));
        createMusicListButton.setIcon(icon);
    }//GEN-LAST:event_createMusicListButtonMouseExited

    private void deleteSelectedMusicLists1MouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_deleteSelectedMusicLists1MouseEntered
        // TODO add your handling code here:
        Icon icon = new ImageIcon(getClass().getResource("/GUI/icons/delete_colour.png"));
        deleteSelectedMusicLists1.setIcon(icon);
    }//GEN-LAST:event_deleteSelectedMusicLists1MouseEntered

    private void deleteSelectedMusicLists1MouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_deleteSelectedMusicLists1MouseExited
        // TODO add your handling code here:
        Icon icon = new ImageIcon(getClass().getResource("/GUI/icons/delete.png"));
        deleteSelectedMusicLists1.setIcon(icon);
    }//GEN-LAST:event_deleteSelectedMusicLists1MouseExited

    private void minmumButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_minmumButtonMouseClicked
        // TODO add your handling code here:
        ui.setExtendedState(JFrame.ICONIFIED);
    }//GEN-LAST:event_minmumButtonMouseClicked

    private void closeButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_closeButtonMouseClicked
        // TODO add your handling code here:
        ui.setVisible(false);
    }//GEN-LAST:event_closeButtonMouseClicked

    private void addLocalToScanFolderNodeButtonMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_addLocalToScanFolderNodeButtonMouseEntered
        // TODO add your handling code here:
        Icon icon = new ImageIcon(getClass().getResource("/GUI/icons/add_colour.png"));
        addLocalToScanFolderNodeButton.setIcon(icon);
    }//GEN-LAST:event_addLocalToScanFolderNodeButtonMouseEntered

    private void addLocalToScanFolderNodeButtonMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_addLocalToScanFolderNodeButtonMouseExited
        // TODO add your handling code here:
        Icon icon = new ImageIcon(getClass().getResource("/GUI/icons/addLocalToScanFolderNode.png"));
        addLocalToScanFolderNodeButton.setIcon(icon);
    }//GEN-LAST:event_addLocalToScanFolderNodeButtonMouseExited

    private void matchMusicButtonMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_matchMusicButtonMouseEntered
        // TODO add your handling code here:
        Icon icon = new ImageIcon(getClass().getResource("/GUI/icons/match_colour.png"));
        matchMusicButton.setIcon(icon);
    }//GEN-LAST:event_matchMusicButtonMouseEntered

    private void matchMusicButtonMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_matchMusicButtonMouseExited
        // TODO add your handling code here:
        Icon icon = new ImageIcon(getClass().getResource("/GUI/icons/match.png"));
        matchMusicButton.setIcon(icon);
    }//GEN-LAST:event_matchMusicButtonMouseExited

    private void defaultListButtonMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_defaultListButtonMouseEntered
        // TODO add your handling code here:
        Icon icon = new ImageIcon(getClass().getResource("/GUI/icons/defaultList_colour.png"));
        defaultListButton.setIcon(icon);
    }//GEN-LAST:event_defaultListButtonMouseEntered

    private void defaultListButtonMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_defaultListButtonMouseExited
        // TODO add your handling code here:
        Icon icon = new ImageIcon(getClass().getResource("/GUI/icons/defaultList.png"));
        defaultListButton.setIcon(icon);
    }//GEN-LAST:event_defaultListButtonMouseExited

    private void artistButtonMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_artistButtonMouseEntered
        // TODO add your handling code here:
        Icon icon = new ImageIcon(getClass().getResource("/GUI/icons/artist_colour.png"));
        artistButton.setIcon(icon);
    }//GEN-LAST:event_artistButtonMouseEntered

    private void artistButtonMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_artistButtonMouseExited
        // TODO add your handling code here:
        Icon icon = new ImageIcon(getClass().getResource("/GUI/icons/artist.png"));
        artistButton.setIcon(icon);
    }//GEN-LAST:event_artistButtonMouseExited

    private void albumButtonMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_albumButtonMouseEntered
        // TODO add your handling code here:
        Icon icon = new ImageIcon(getClass().getResource("/GUI/icons/album_colour.png"));
        albumButton.setIcon(icon);
    }//GEN-LAST:event_albumButtonMouseEntered

    private void albumButtonMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_albumButtonMouseExited
        // TODO add your handling code here:
        Icon icon = new ImageIcon(getClass().getResource("/GUI/icons/album.png"));
        albumButton.setIcon(icon);
    }//GEN-LAST:event_albumButtonMouseExited

    private void localListButtonMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_localListButtonMouseEntered
        // TODO add your handling code here:
         Icon icon = new ImageIcon(getClass().getResource("/GUI/icons/local_colour.png"));
        localListButton.setIcon(icon);
    }//GEN-LAST:event_localListButtonMouseEntered

    private void localListButtonMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_localListButtonMouseExited
        // TODO add your handling code here:
         Icon icon = new ImageIcon(getClass().getResource("/GUI/icons/local.png"));
        localListButton.setIcon(icon);
    }//GEN-LAST:event_localListButtonMouseExited

    private void searchLocalMusicLabelMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_searchLocalMusicLabelMouseEntered
        // TODO add your handling code here:
        Icon icon = new ImageIcon(getClass().getResource("/GUI/icons/search_colour.png"));
        searchLocalMusicLabel.setIcon(icon);
    }//GEN-LAST:event_searchLocalMusicLabelMouseEntered

    private void searchLocalMusicLabelMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_searchLocalMusicLabelMouseExited
        // TODO add your handling code here:
        Icon icon = new ImageIcon(getClass().getResource("/GUI/icons/search.png"));
        searchLocalMusicLabel.setIcon(icon);
    }//GEN-LAST:event_searchLocalMusicLabelMouseExited

    private void addLocalToScanFolderNodeButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_addLocalToScanFolderNodeButtonMouseClicked
        //生成选择目录对话框
        dialog.setLocationRelativeTo(this);
        dialog.setVisible(true);
    }//GEN-LAST:event_addLocalToScanFolderNodeButtonMouseClicked

    private void createMusicListButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_createMusicListButtonMouseClicked
        // TODO add your handling code here:
        createMusicListDialog dialog = new createMusicListDialog(this,true);
        dialog.setLocation(MouseInfo.getPointerInfo().getLocation());
        dialog.setVisible(true);
    }//GEN-LAST:event_createMusicListButtonMouseClicked

    private void createMusicListsPanelMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_createMusicListsPanelMouseClicked
        // TODO add your handling code here:
    }//GEN-LAST:event_createMusicListsPanelMouseClicked

    private void deleteSelectedMusicLists1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_deleteSelectedMusicLists1MouseClicked
        deleteSelectedMusicList(createMusicListsPanel);
    }//GEN-LAST:event_deleteSelectedMusicLists1MouseClicked

    private void matchMusicButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_matchMusicButtonMouseClicked
        //扫描所有待扫描文件夹
        LinkedListManager.getInstance().setLocalListNode(LinkedListManager.getInstance().scanAndCreateLocalListNode());
        //更新UI
        printMusicList(musicListTabel);
    }//GEN-LAST:event_matchMusicButtonMouseClicked

    private void sortByComboxMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_sortByComboxMouseClicked
    }//GEN-LAST:event_sortByComboxMouseClicked

    private void sortByComboxItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_sortByComboxItemStateChanged
        if (evt.getStateChange() == ItemEvent.SELECTED) {
            switch(sortByCombox.getSelectedIndex()){
                //以默认排序时
                case 0:{
                    sortby = SortBy.DEFAULT;
                    break;
                }
                //以歌曲名排序时
                case 1:{
                    sortby = SortBy.SONGNAME;
                    break;
                }
                //以歌手排序时
                case 2:{
                    sortby = SortBy.ARTIST;
                    break;
                }
                //以专辑来排序时
                case 3:{
                    sortby = SortBy.ALBUM;
                    break;
                }
            }
            printMusicList(musicListTabel);
            //如果当前访问的card是card2的话，则需要重置classifyPanel的值
            if (currentCard.equals("card2")) {
                printMusicList(classifyMusicListTabel);
            }
        }
    }//GEN-LAST:event_sortByComboxItemStateChanged

    private void searchInLocalMusicListTextFiledKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_searchInLocalMusicListTextFiledKeyReleased
        String str = evt.paramString().split("[,]")[3];
        String text = searchInLocalMusicListTextFiled.getText().trim();
        //当为有效字符时
        if ( ((!str.contains(" "))  && (!str.contains("Enter")) && (!str.contains("Delete")))) {
                //清空musicListTabel
                DefaultTableModel model = (DefaultTableModel)musicListTabel.getModel();
                model.getDataVector().clear();   //清除表格数据
                model.fireTableDataChanged();//通知模型更新
                musicListTabel.updateUI();
                //重置当前访问的链表集合以及链表
                LinkedListManager.getInstance().setCurrentVisitMusicLists(transientCurrentVisitMusicLists);
                LinkedListManager.getInstance().setCurrentVisitMusicList(transientCurrentVisitMusicList);
                //在链表中检索
                Node<MusicListNode> searchResultList = LinkedListManager.getInstance().searchInMusicList(text);
                Node<MusicNode> p = searchResultList.info.head;
                //设置当前访问的链表
                LinkedListManager.getInstance().setCurrentVisitMusicList(searchResultList);
                //更新UI
                while(p != null){
                    MusicNode info = p.info;
                    model.addRow(new String[]{info.getSongName(),info.getArtist(),info.getAlbum(),info.getTime_String()});
                    p = p.next;
                }
        }
    }//GEN-LAST:event_searchInLocalMusicListTextFiledKeyReleased

    private void nextMusicButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_nextMusicButtonMouseClicked
        if (PlayScheduleManager.getInstance().currentPlayMusicList != null) {
            MusicPlayer.musicPlayer.playMp3FileImmediately(PlayScheduleManager.getInstance().getNextPlayDefault().info.getFilePath());
            musicNameLabel.setText(PlayScheduleManager.getInstance().pCurrentPlayMusicNodeCopy.info.getSongName());
            //设置currentPlayTimeJSlider以及currentPlayTimeJLabel
            currentPlayTimeJSlider.setMaximum(PlayScheduleManager.getInstance().pCurrentPlayMusicNodeCopy.info.getTime_Int());
            currentPlayTimeJSlider.setValue(0);
            currentPlayTimeJLabel.setText("00:00" +  "/" + PlayScheduleManager.getInstance().pCurrentPlayMusicNodeCopy.info.getTime_String());
            //重置播放进度条线程的currentPlayTime
            MusicPlayer.currentPlayTime = 0;
        }
    }//GEN-LAST:event_nextMusicButtonMouseClicked

    private void searchInLocalMusicListTextFiledActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_searchInLocalMusicListTextFiledActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_searchInLocalMusicListTextFiledActionPerformed

    private void currentPlayTimeJSliderMouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_currentPlayTimeJSliderMouseReleased
        if (PlayScheduleManager.getInstance().currentPlayMusicList != null) {
            //控制进度条
            double percent = (currentPlayTimeJSlider.getValue() * 1.0) / currentPlayTimeJSlider.getMaximum();
            //更新currentPlayTimeJLabel
            int time = (int)(PlayScheduleManager.getInstance().pCurrentPlayMusicNodeCopy.info.getTime_Int() * percent);
            //格式化输出时间
            String minute = null;
            String seconds = null;
            if ((time / 60) < 10) {
                minute = "0" + String.valueOf(time / 60);
            }
            else{
                minute = String.valueOf(time / 60);
            }
            if ((time % 60) < 10) {
                seconds = "0" + String.valueOf(time % 60);
            }
            else{
                seconds = String.valueOf(time % 60);
            }
            currentPlayTimeJLabel.setText(minute + ":" + seconds + "/" + PlayScheduleManager.getInstance().pCurrentPlayMusicNodeCopy.info.getTime_String());
            //重置播放进度条线程的currentPlayTime
            MusicPlayer.currentPlayTime = time;
            MusicPlayer.musicPlayer.randomPositionPlay(percent, PlayScheduleManager.getInstance().pCurrentPlayMusicNodeCopy.info.getFilePath());
        }
    }//GEN-LAST:event_currentPlayTimeJSliderMouseReleased

    private void searchLocalMusicLabel1MouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_searchLocalMusicLabel1MouseEntered
        // TODO add your handling code here:
    }//GEN-LAST:event_searchLocalMusicLabel1MouseEntered

    private void searchLocalMusicLabel1MouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_searchLocalMusicLabel1MouseExited
        // TODO add your handling code here:
    }//GEN-LAST:event_searchLocalMusicLabel1MouseExited

    private void searchInLocalMusicListsTextFiledKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_searchInLocalMusicListsTextFiledKeyReleased
        String str = evt.paramString().split("[,]")[3];
        String text = searchInLocalMusicListsTextFiled.getText().trim();
        if ( (!str.contains(" "))  && (!str.contains("Enter")) && (!str.contains("Delete")) ){
                //清空classifyMusicListTabel
                DefaultTableModel model = (DefaultTableModel)classifyMusicListTabel.getModel();
                model.getDataVector().clear();   //清除表格数据
                model.fireTableDataChanged();//通知模型更新
                classifyMusicListTabel.updateUI();
                //清空classifyListPanel
                classifyListPanel.removeAll();
                classifyListPanel.updateUI();
                 //重置当前访问的链表集合
                LinkedListManager.getInstance().setCurrentVisitMusicLists(transientClassifyCurrentVisitMusicLists);
                //在链表中检索
                MusicLists searchResultLists = LinkedListManager.getInstance().searchInMusicLists(text);
                //设置当前访问的链表集合与当前正在访问的链表
                LinkedListManager.getInstance().setCurrentVisitMusicLists(searchResultLists);
                LinkedListManager.getInstance().setCurrentVisitMusicList(null);
                if(searchResultLists != null){
                        Node<MusicListNode> p = searchResultLists.head;
                         //更新UI
                         while(p != null){
                         JLabel newLabel = new JLabel(p.info.toString());
                         newLabel.setFont(new java.awt.Font("楷体", 0, 24));
                         newLabel.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
                         newLabel.setBackground(new Color(250,250,250));
                         newLabel.addMouseListener(new MouseAdapter(){
                                     @Override
                                     public void mouseClicked(MouseEvent e) {
                                           //修改当前访问的链表
                                          LinkedListManager.getInstance().setCurrentVisitMusicList(LinkedListManager.getInstance().findSetectedMusicList(searchResultLists, newLabel.getText()));
                                          //将数据写入classifyMusicListTabel
                                          printMusicList(classifyMusicListTabel);
                                     }
                         });
                         classifyListPanel.add(newLabel);
                         classifyListPanel.revalidate();
                         p = p.next;
                     }
                }
        }
    }//GEN-LAST:event_searchInLocalMusicListsTextFiledKeyReleased

    private void searchInLocalMusicListTextFiledFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_searchInLocalMusicListTextFiledFocusLost
        searchInLocalMusicListTextFiled.setText("搜索乐曲");
    }//GEN-LAST:event_searchInLocalMusicListTextFiledFocusLost

    private void searchInLocalMusicListsTextFiledFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_searchInLocalMusicListsTextFiledFocusLost
        searchInLocalMusicListsTextFiled.setText("搜索歌单");
    }//GEN-LAST:event_searchInLocalMusicListsTextFiledFocusLost

    private void searchInLocalMusicListTextFiledFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_searchInLocalMusicListTextFiledFocusGained
        searchInLocalMusicListTextFiled.setText("");
    }//GEN-LAST:event_searchInLocalMusicListTextFiledFocusGained

    private void searchInLocalMusicListsTextFiledFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_searchInLocalMusicListsTextFiledFocusGained
       searchInLocalMusicListsTextFiled.setText("");
    }//GEN-LAST:event_searchInLocalMusicListsTextFiledFocusGained
    
    private void deleteSelectedMusicList(JPanel selectedJPanel){
        //首先在UI上删除该组件
        int index = 1;
        Node<MusicListNode> currentVisitMusicList = LinkedListManager.getInstance().getCurrentVisitMusicList();
        Node<MusicListNode> p = LinkedListManager.getInstance().getCurrentVisitMusicLists().head;
        while(p != null){
            if (currentVisitMusicList == p) {
                break;
            }
            ++index;
            p = p.next;
        }
        selectedJPanel.remove(index - 1);
        selectedJPanel.updateUI();
        //清空JTable
        DefaultTableModel model = (DefaultTableModel)musicListTabel.getModel();
        model.getDataVector().clear();   //清除表格数据
        model.fireTableDataChanged();//通知模型更新
        musicListTabel.updateUI();
        
        model = (DefaultTableModel)classifyMusicListTabel.getModel();
        model.getDataVector().clear();   //清除表格数据
        model.fireTableDataChanged();//通知模型更新
        classifyMusicListTabel.updateUI();
        
        classifyListPanel.removeAll();
        //置空中间变量
        transientCurrentVisitMusicList = null;
       //然后在链表管理器中删除对应的链表
       LinkedListManager.getInstance().deleteMusicList(LinkedListManager.getInstance().getCreateMusicLists(), index);
        //当前访问的链表被置空
        LinkedListManager.getInstance().setCurrentVisitMusicList(null);
    }
    
    private JPopupMenu createJPopupMenu(int selectedRowIndex){
        JPopupMenu menu = new JPopupMenu();
        //右键菜单组件
        JMenuItem  play = new JMenuItem();
        play.setText("播放");
        play.setFont(new java.awt.Font("楷体", 0, 24));
        JMenuItem nextPlay = new JMenuItem();
        nextPlay.setText("下一首播放");
        nextPlay.setFont(new java.awt.Font("楷体", 0, 24));
        JMenu collectToMusicList = new JMenu("收藏到歌单");
        collectToMusicList.setFont(new java.awt.Font("楷体", 0, 24));
        JMenuItem deleteFromMusicList = new JMenuItem();
        deleteFromMusicList.setText("从歌单中删除");
        deleteFromMusicList.setFont(new java.awt.Font("楷体", 0, 24));
        
        
        //定义每个组件需要做的事情
        //1.播放按钮
        play.addActionListener(new ActionListener(){
            @Override
            public void actionPerformed(ActionEvent ae) {
                    //找到所选择的歌曲结点
                    int index = selectedRowIndex;
                    --index;
                    Node<MusicNode> selectedMusicNode = LinkedListManager.getInstance().getCurrentVisitMusicList().info.head;
                    while(index != 0){
                        selectedMusicNode = selectedMusicNode.next;
                        --index;
                    }
                    //更新musicNameLabel
                    musicNameLabel.setText(selectedMusicNode.info.getSongName());
                    //设置currentPlayTimeJSlider以及currentPlayTimeJLabel
                    currentPlayTimeJSlider.setMaximum(selectedMusicNode.info.getTime_Int());
                    currentPlayTimeJSlider.setValue(0);
                    currentPlayTimeJLabel.setText("00:00" +  "/" + selectedMusicNode.info.getTime_String());
                    //执行播放
                    PlayScheduleManager.getInstance().playImmediately(selectedMusicNode);
               }
        });
        //2.下一首播放按钮
        nextPlay.addActionListener(new ActionListener(){
            @Override
            public void actionPerformed(ActionEvent ae) {
                 //找到所选择的歌曲结点
                    int index = selectedRowIndex;
                    --index;
                    Node<MusicNode> selectedMusicNode = LinkedListManager.getInstance().getCurrentVisitMusicList().info.head;
                    while(index != 0){
                        selectedMusicNode = selectedMusicNode.next;
                        --index;
                    }
                    PlayScheduleManager.getInstance().setNextPlay(selectedMusicNode);
            }
        });
        //3.从歌单中删除按钮
        deleteFromMusicList.addActionListener(new ActionListener(){
            @Override
            public void actionPerformed(ActionEvent ae) {
                //从UI上删除
                DefaultTableModel model = (DefaultTableModel)musicListTabel.getModel();
                model.removeRow(selectedRowIndex - 1);
                //从链表中删除
                LinkedListManager.getInstance().deleteMusic(selectedRowIndex);
            }
        });
        //4.收藏到歌单按钮
        //设置收藏到歌单按钮的歌单列表
        Node<MusicListNode> p = LinkedListManager.getInstance().getCreateMusicLists().head;
        while(p != null){
            //不允许将歌曲收藏到原本已经存在的歌单中
            if (!(p.info.toString().equals(transientCurrentVisitMusicList.info.toString()))) {
                    JMenuItem item = new JMenuItem(p.info.toString());
                    item.setFont((new java.awt.Font("楷体", 0, 24)));
                    //当按下收藏到的某个歌单按钮的时候，将当前歌曲收藏到选定的歌单
                    item.addMouseListener(new MouseAdapter(){
                                //JMenuItem只能检测到mousePressed事件
                                @Override
                                public void mousePressed(MouseEvent e) {
                                        //将歌曲添加到链表中
                                        //找到所选择的歌曲结点
                                        int index = selectedRowIndex;
                                        --index;
                                        Node<MusicNode> selectedMusicNode = LinkedListManager.getInstance().getCurrentVisitMusicList().info.head;
                                        while(index != 0){
                                            selectedMusicNode = selectedMusicNode.next;
                                            --index;
                                        }
                                        //找到所选择的歌单的下标
                                        index = 1;
                                        String listName = item.getText();
                                        Node<MusicListNode> pListNode = LinkedListManager.getInstance().getCreateMusicLists().head;
                                        while(pListNode != null){
                                            if (listName.equals(pListNode.info.toString())) {
                                                break;
                                            }
                                            pListNode = pListNode.next;
                                            ++index;
                                        }
                                        LinkedListManager.getInstance().collectMusic(selectedMusicNode, index);
                                }
                    });
                    collectToMusicList.add(item);
            }
            p = p.next;
        }
        //将组件添加至popupMenu
        menu.add(play);
        menu.add(nextPlay);
        menu.add(deleteFromMusicList);
        menu.add(collectToMusicList);
        return menu;
    }
    
    private static MusicPlayerUI ui = new MusicPlayerUI();
    private int locationX,locationY;
    public ChooseLocalToScanFolderDialog dialog = new ChooseLocalToScanFolderDialog(ui,true);
    public MusicLists transientCurrentVisitMusicLists;
    public MusicLists transientClassifyCurrentVisitMusicLists;
    public Node<MusicListNode> transientCurrentVisitMusicList;
    public String currentCard;//用于指向当前访问的card是哪张card
    private SortBy sortby;
    
    
    public static MusicPlayerUI getInstance(){
        return ui;
    }
    
    public JPanel getCreateMusicListsPanel(){
        return createMusicListsPanel;
    }
    
    public JTable getMusicListTabel(){
        return musicListTabel;
    }
    
    public JTable getClassifyMusicListTabel(){
        return classifyMusicListTabel;
    }
    
    public JLabel getCurrentVisitMusicListLabel(){
        return currentVisitMusicListLabel;
    }
    
    public JButton getPlayModeButton() {
        return playModeButton;
    }
    
    public JPanel getListPanel(){
        return listPanel;
    }
    
    public JButton getPlay_PauseButton(){
        return play_pauseButton;
    }
    
    public JLabel getMusicNameLabel(){
        return musicNameLabel;
    }
    
    public JSlider getCurrentPlayTimeJSlider(){
        return currentPlayTimeJSlider;
    }
    
    public JLabel getCurrentPlayTimeJLabel(){
        return currentPlayTimeJLabel;
    }
    
    public JButton getAddLocalToScanFolderNodeButton(){
        return addLocalToScanFolderNodeButton;
    }
    
    public JButton getMatchMusicButton(){
        return matchMusicButton;
    }
    
    //将当前访问的链表中的数据读取到musicListTabel中
    public void printMusicList(JTable selectedJTable){
        Node<MusicListNode> currentVisitMusicList;
        //默认排序方式
        if (sortby == SortBy.DEFAULT) {
            if (currentCard.equals("card1")) {
                LinkedListManager.getInstance().setCurrentVisitMusicList(transientCurrentVisitMusicList);
            }
            currentVisitMusicList = LinkedListManager.getInstance().getCurrentVisitMusicList();
        }
        //根据当前选择的排序模式来构造链表
        else{
               currentVisitMusicList = LinkedListManager.getInstance().sort(sortby);
               LinkedListManager.getInstance().setCurrentVisitMusicList(currentVisitMusicList);
        }
        if (currentVisitMusicList != null) {
             //首先清空当前JTable
            DefaultTableModel model = (DefaultTableModel)selectedJTable.getModel();
            model.getDataVector().clear();   //清除表格数据
            model.fireTableDataChanged();//通知模型更新
            selectedJTable.updateUI();
            Node<MusicNode> p = currentVisitMusicList.info.head;
            while(p != null){
                MusicNode info = p.info;
                if (selectedJTable == musicListTabel) {
                    model.addRow(new String[]{info.getSongName(),info.getArtist(),info.getAlbum(),info.getTime_String()});
                }
                else{
                    model.addRow(new String[]{info.getSongName(),info.getArtist(),info.getAlbum(),info.getTime_String(),info.getFilePath()});
                }
                 p = p.next;
            }
            selectedJTable.updateUI();
        }
    }
    
    
    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel MusicPlayerIcon;
    private javax.swing.JButton addLocalToScanFolderNodeButton;
    private javax.swing.JButton albumButton;
    private javax.swing.JButton artistButton;
    private javax.swing.JPanel classifyListPanel;
    private javax.swing.JTable classifyMusicListTabel;
    private javax.swing.JPanel classifyPanel;
    private javax.swing.JButton closeButton;
    private javax.swing.JButton createMusicListButton;
    private javax.swing.JPanel createMusicListsPanel;
    private javax.swing.JLabel currentPlayTimeJLabel;
    private javax.swing.JSlider currentPlayTimeJSlider;
    private javax.swing.JLabel currentVisitMusicListLabel;
    private javax.swing.JButton defaultListButton;
    private javax.swing.JButton deleteSelectedMusicLists1;
    private javax.swing.Box.Filler filler1;
    private javax.swing.JPanel functionPanel;
    private javax.swing.JPanel iconPanel;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane5;
    private javax.swing.JScrollPane jScrollPane6;
    private javax.swing.JPanel listPanel;
    private javax.swing.JButton localListButton;
    private javax.swing.JLabel localMusicListIconLabel;
    private javax.swing.JLabel localMusicListLabel;
    private javax.swing.JPanel localMusicListPanel;
    private javax.swing.JPanel mainPanel;
    private javax.swing.JButton matchMusicButton;
    private javax.swing.JButton minmumButton;
    private javax.swing.JLabel musicCcoverIconLabel;
    private javax.swing.JPanel musicInfoPanel;
    private javax.swing.JPanel musicListInfoPanel;
    private javax.swing.JTable musicListTabel;
    private javax.swing.JPanel musicListsPanel;
    private javax.swing.JLabel musicNameLabel;
    private javax.swing.JButton nextMusicButton;
    private javax.swing.JPanel playControllerPanel;
    private javax.swing.JButton playModeButton;
    private javax.swing.JButton play_pauseButton;
    private javax.swing.JButton preMusicButton;
    private javax.swing.JTextField searchInLocalMusicListTextFiled;
    private javax.swing.JTextField searchInLocalMusicListsTextFiled;
    private javax.swing.JLabel searchLocalMusicLabel;
    private javax.swing.JLabel searchLocalMusicLabel1;
    private javax.swing.JComboBox<String> sortByCombox;
    private javax.swing.JPanel titleBarPanel;
    // End of variables declaration//GEN-END:variables

    
}
